package jUnitTests;

import static org.junit.Assert.*;
import org.junit.*;
import huaabdelmartin.*;

public class CarTests {
	
	@Test
	public void testCar()  {
		//test that different (and incorrect) formats of Car Registration throw exception, if works all tests should pass
		try{ //extra letter u
			Car c1 = new Car("AB12 uRTE",new Driver("bob","smith","34"),true,5);
		} catch(VehicleRegFormatException e){assertTrue(e.getMessage().contains("is not in the format of LLNN LLL"));}
			
		try{ //missing a space in the car registration
			Car c2 = new Car("AB12RTE",new Driver("bob","smith","34"),true,5);
		} catch(VehicleRegFormatException e){assertTrue(e.getMessage().contains("is not in the format of LLNN LLL"));}
			
		try{ //lower case letter
			Car c3 = new Car("aB12 RTE",new Driver("bob","smith","34"),true,5);
		} catch(VehicleRegFormatException e){assertTrue(e.getMessage().contains("is not in the format of LLNN LLL"));}
		
		try{ //letter instead of number
			Car c4 = new Car("ABC2 RTE",new Driver("bob","smith","34"),true,5);
		} catch(VehicleRegFormatException e){assertTrue(e.getMessage().contains("is not in the format of LLNN LLL"));}
			//code shouldn't reach here
	}
}
